package com.interview.javabasic.IO;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class BIOPlainEchoServer {
    public void server(int port) throws IOException{
        //将serverSocket绑定到指定的端口号
        final ServerSocket socket = new ServerSocket(port);
        //创建一个线程池
        ExecutorService executorService = Executors.newFixedThreadPool(6);
        while(true){
            //阻塞直到有新客户端连接
            final Socket clientSocket = socket.accept();
            System.out.println("Accepted connectin from " + clientSocket);
            //将请求交给线程池去处理
            executorService.execute(()->{

            });
        }
    }
}
